/////////////////////////////////////////////////////////////////////////////
// Name:        ax_menu_colour.h
// Purpose:     Colour selection menu
// Author:      Julian Smart
// Modified by:
// Created:     2009-03-20
// RCS-ID:
// Copyright:   (c) Julian Smart
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _AX_MENU_COLOUR_H_
#define _AX_MENU_COLOUR_H_

/*
 * Includes
 */

#include "ax/ax_menu_choice.h"
 
/**
    @class AxColourMenuItem

    A colour selection menu, using colour names.

    @category{ax}

 */

class AxColourMenuItem: public AxChoiceMenuItem
{
    DECLARE_DYNAMIC_CLASS( AxColourMenuItem )

public:
// Constructors

    AxColourMenuItem(const AxColourMenuItem& item) { Copy(item); }
    AxColourMenuItem() {}
    AxColourMenuItem(const wxString& label, const wxString& description,
        const wxString& id,
        const wxColour& colour);
    bool Create(const wxString& label, const wxString& description,
        const wxString& id,
        const wxColour& colour);

    void Copy(const AxColourMenuItem& item);

    virtual AxMenuItem* Clone() { return new AxColourMenuItem(* this); }

    void SetColour(const wxColour& colour);
    wxColour GetColour() const { return m_colour; }

    /// Set current selection
    virtual void SetSelection(int i);

#if 0
    wxString CreateString(const wxString& spec, bool isLabel);
#endif

protected:

    wxColour    m_colour;
};

/**
    @class AxColourValidator
 */

class AxColourValidator: public AxValidator
{
    DECLARE_DYNAMIC_CLASS( AxColourValidator )

public:
// Constructors

    AxColourValidator(const AxColourValidator& validator) { Init(); Copy(validator); }
    AxColourValidator(wxColour* ptr) { Init(); m_colourPtr = ptr; }
    AxColourValidator() { Init(); }

// Operations

    void Copy(const AxColourValidator& validator)
    {
        AxColourValidator::Copy(validator);

        m_colourPtr = validator.m_colourPtr;
    }

    virtual AxValidator* Clone() const { return new AxColourValidator(*this); }

    /// Override to pass a value from the UI to a data structure
    virtual bool TransferDataFromMenu();

    /// Override to pass a value from a data structure to the UI
    virtual bool TransferDataToMenu();

    /// Initialize variables
    void Init() { m_colourPtr = NULL; }

protected:
    wxColour*   m_colourPtr;
};

#endif
    // _AX_MENU_COLOUR_H_
